package com.itcaius.weblog.admin.runner;

import com.itcaius.weblog.admin.service.AdminStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author Caius
 * @description
 * @since Created in 2025-06-15
 */
@Component
@Slf4j
public class StatisticsCategoryArticleTotalRunner implements CommandLineRunner {

    @Autowired
    private AdminStatisticsService adminStatisticsService;

    @Override
    @Async("threadPoolTaskExecutor")
    public void run(String... args) throws Exception {
        log.info("==> 开始统计分类下的文章数量...");
        adminStatisticsService.statisticsCategoryArticleTotal();
        log.info("==> 统计分类下的文章数量结束...");
    }
}
